@extends('default.layouts.companyPublic')

@section('title', '收到应聘简历')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/company/list.css')}}">
    <link rel="stylesheet" href="{{asset('/vendor/jedate/skin/jedate.css')}}">
@endsection

@section('rightcon')
    <div class="right">
        <div class="jright">
            <div class="content">
                <div class="jobtitle">
                    <div class="tithead">
                        <ul>
                            <li class="active"><a href="{{url('company/resume_message')}}">收到应聘简历</a></li>
                            <li><a href="{{url('company/resume_favorite')}}">企业人才库</a></li>
                            <li><a href="{{url('company/resume_buy')}}">已购买简历</a></li>
                            <li><a href="{{url('company/browse_resume')}}">浏览简历记录</a></li>
                            <li><a href="{{url('company/browse_company')}}">谁浏览过我</a></li>
                        </ul>
                    </div>
                </div>
                {{--\搜索内容--}}
                <div class="jobsearch">
                    <form name="Formso" action="{{url('company/resume_message')}}" method="get">
                        {!! csrf_field() !!}
                        <span><input name="keyWord" class="keyWord" value="" id="keyWord" placeholder="请输入职位名称或简历姓名" type="text"/></span>
                        <span><input name="submit" class="searpos" value="" id="" type="submit"/></span>
                    </form>
                </div>
                {{--显示列表--}}
                <div class="pinfo">
                    <form name="thisForm" action="{{url('company/jobadmin')}}" method="post">
                        {!! csrf_field() !!}
                        <div class="listmenu">
                            <ul class="one">
                                <li class="p1"></li>
                                <li class="p100">姓名</li>
                                <li class="p3">应聘岗位</li>
                                <li class="p2">基本信息</li>
                                <li class="p4">
                                    <div class="status">
                                        <input id="status" name="status" value="{{$status}}" type="hidden">
                                        <div id="status_select" class="select" style="width:126px; height:28px; line-height: 28px;">
                                            <span><a></a></span><i></i>
                                        </div>
                                    </div>
                                </li>
                                <li class="p5">应聘时间</li>
                                <li class="p90">回复</li>
                            </ul>
                            <div class="information"><span>共收到<em>{{$relist->total()}}</em>份投递简历记录！</span></div>
                            {{--循环--}}
                            @if($relist->count() > 0 )
                                @foreach($relist as $v)
                                    <ul id="list{{$v->id}}">
                                        <li class="p1">
                                            <input name="selected_id[]" class="checkboxs" value="{{$v->id}}" type="checkbox"/>
                                        </li>
                                        <li class="p100"><a class="linkbright" target="_blank" href="{{url('/resume_'.idEncryption($v->resume_id).'.html')}}">{{str_limit($v->name,9)}}</a></li>
                                        <li class="p3"><a target="_blank" href="{{url('/jobinfo_'.idEncryption($v->job_id).'.html')}}">{{str_limit($v->job_title,16)}}</a></li>
                                        <li class="p2">{{str_limit($v->cnsex.' | '.$v->birthday.'岁 | '.$v->education.' | '.$v->homeaddress,26)}}</li>
                                        <li class="p4">
                                            @if($v->status == '1')
                                                <span class="statusval">未回复</span>
                                            @elseif($v->status == '2')
                                                <span class="statusval normal">已邀约</span>
                                            @elseif($v->status == '3')
                                                <span class="statusval declined">已婉拒</span>
                                            @elseif($v->status == '0')
                                                <span class="statusval bright">未查看</span>
                                            @endif
                                        </li>
                                        <li class="p5">{{timeTranx($v->created_at)}}</li>
                                        <li class="p90">
                                            <input id="reply{{$v->id}}" name="reply{{$v->id}}" value="" type="hidden">
                                            <div id="reply{{$v->id}}_select" class="select" style="width:80px; height:28px; line-height: 28px; margin-top:26px;">
                                                <span style="width: 60px"><a>回复</a></span><i></i>
                                            </div>
                                        </li>
                                    </ul>
                                @endforeach
                            @else
                                <div class="nullcon">对不起！没有符合条件的记录！</div>
                            @endif
                            <ul class="one last">
                                <li class="p1" style="width:80px;">
                                    <input name="selectall" id="selectall" class="checkboxs" value="234" type="checkbox" onclick="CheckAll(this)"/>
                                    <label for="selectall">全选</label>
                                </li>
                                <li class="p800">
                                    <span class="pborder" onclick="showconfirm('{{url('company/resume_tofavorite')}}','您真的要把选中的简历放入人才库吗')">放入人才库</span>
                                    <span class="pborder" onclick="showconfirm('{{url('company/destroy')}}','您真的要把选中的简历删除吗')">删除</span>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>
                {{--分页--}}
                <div class="page_list">
                    {!! $relist->links() !!}
                </div>
            </div>
        </div>
    </div>

@endsection
@section('footerjs')
    @parent
    <script type="text/javascript" src="{{asset('/default/js/company/list.js')}}"></script>
    <script type="text/javascript" src="/default/js/jquery/jquery.form.js"></script>
    <script type="text/javascript" src="/default/js/jquery/jquery.jedate.js"></script>
    <script type="text/javascript" src="/default/js/index/interview.js"></script>
    <script type="text/javascript">
	$("#leftnav_resume").addClass("active");
    var statusData = [
        {"value": '', "text": "状态不限"},
        {"value": 0, "text": "未查看"},
        {"value": 1, "text": "未回复"},
        {"value": 2, "text": "已邀约"},
        {"value": 3, "text": "已婉拒"}
    ];
    $("#status").select({
        optionData: statusData,
        callback: function (val, text) {
            window.location = "{{url('company/resume_message')}}?status=" + val;
        }
    });
    var relistData = [
        {"value": 2, "text": "邀约"},
        {"value": 3, "text": "婉拒"}
    ];
    @if($relist->count() > 0 )
        @foreach($relist as $v)
        $("#reply{{$v->id}}").select({
            optionData: relistData,
            defaults:null,//默认按索引选中null为不选
            defaultFill:[{"value": '', "text": "回复"}],//当defaults为null时,填空使用这个
            callback: function (val, text) {
                if(val==2){
                    {{--//绑定面试邀请框    {{ $v->resume_id }}--}}
                    $.interview({
                        userName:"{{ $v->name }}",
                        url:"{{url('company/inviteinterview')}}",
                        interviewUrl:"{{url('company/interviewnote')}}",
                        postJobUrl:"{{ url("company/jobpublish") }}",
                        crsf:"{{csrf_token()}}",
                        resumeId: "{{ $v->resume_id }}",
                        jobId:"{{ $v->job_id }}",
                        callBack:function(status){}
                    });
                }
                $.post("/company/resume_status", {
                    'id': '{{$v->id}}',
                    'status': val,
                    '_token': "{{csrf_token()}}"
                }, function (data) {
                    if (data.status == 2) {
                       // layer.msg(data.msg, {icon: 6, time: 1500});

                    }else if(data.status == 3){
                        layer.msg(data.msg, {icon: 5, time: 1500});
                    }else {
                        layer.msg("回复失败,系统错误", {icon: 5, time: 1500});
                    }
                }, "json");
            }
        });
        @endforeach
    @endif
    @if(session('info'))
    layer.ready(function(){
         layer.msg("{{session('info')}}");
    });
    @endif
    </script>

@endsection